<?php
	$dbhost = "localhost";
	$db = "torneotcb";
	$dbuser = "torneotcb";
	$dbpass = "torneo1tcb";
	$crlf = "\n";
	
	$CARGO_ADMI = 100;
	$CARGO_ENCA = 50;
	$CARGO_EQUI = 25;
	
	$fb_appId = "619805304709388";
	$fb_appSecret = "fbcec127f84cd59c6a7d42a6d9bb06cc";
	$fb_id_fanpage = "126750014062523";

	function isOnMobile() {
		// match popular mobile devices
		if (preg_match('/phone|iphone|itouch|ipod|symbian|android|htc_|htc-|palmos|blackberry|opera mini|mobi|windows ce|nokia|fennec|hiptop|kindle|mot |mot-|webos\/|samsung|sonyericsson|^sie-|nintendo|mobile/', strtolower($_SERVER['HTTP_USER_AGENT'])))
		{
			return TRUE;
		}
		return FALSE;
	}
	
	function ejecutarCMD($strSQL, $dbhost, $db, $dbuser, $dbpass) {
		$conn = new mysqli($dbhost, $dbuser, $dbpass, $db);
		
		$strError = "";
		
		if (!$conn->query($strSQL))
			$strError = $conn->error;
		$conn->close();
		
		if ($strError == "")
			return TRUE;
		else
			return $strError;
	}
	
	function buscarDato($strSQL, $dbhost, $db, $dbuser, $dbpass) {
		$conn = new mysqli($dbhost, $dbuser, $dbpass, $db);
		
		$strSalida = "";
		
	    if (!($tabla = $conn->query($strSQL))) {
			$strSalida = "Error al realizar la consulta.";
	    }
	    else {
	    	$fila = $tabla->fetch_array();
	    	$strSalida = $fila[0];
	    	$tabla->free();
	    }
		
	    $conn->close();
	    
		return $strSalida;
	}
	
	function truncar($numero) {
		$posicion = strrpos($numero, ".");
		if ($posicion > -1)
			$numero = substr($numero,0,$posicion);
		return $numero;
	}
?>
